package webapp.mvc.models;

import com.zoowii.jpa_utils.extension.ExtendFinder;
import com.zoowii.jpa_utils.orm.Model;
import webapp.mvc.utils.IdGenerator;
import webapp.mvc.utils.TimeUtil;

import javax.persistence.*;
import java.sql.Timestamp;

@Entity
@Table(name = "site_config")
public class SiteConfigEntity extends Model {
    public static final ExtendFinder<String, SiteConfigEntity> find = new ExtendFinder<>(String.class, SiteConfigEntity.class);

    private String id = IdGenerator.nextId();
    private String key;
    private String value;
    private Timestamp createTime = TimeUtil.currentTimestamp();
    private Timestamp modifyTime = TimeUtil.currentTimestamp();

    @Id
    @Column(name = "id", nullable = false)
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Column(name = "key", nullable = false)
    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    @Column(name = "value", nullable = false)
    @Lob
    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @Column(name = "create_time", nullable = false)
    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    @Column(name = "modify_time", nullable = false)
    public Timestamp getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(Timestamp modifyTime) {
        this.modifyTime = modifyTime;
    }
}
